<template>
  <div class="container">
    <div class="left">
      <div class="blue-square" v-for="(item,index) in items" :key="index">
        <img v-bind:src="item.SubImageList.SubImageInfoObject[0].StoragePath" alt @click="$imgPreview" :data-img="item.SubImageList.SubImageInfoObject[0].StoragePath"/>
      </div>
    </div>
    <div class="right">
      <div class="subtitle">
        <img src="../assets/image/blue_point.png" alt />
        实时人脸
      </div>
      <div class="count-wrapper">
        <div class="in-count">
          <img src="../assets/image/indoor.png" alt />
          <span>
            <div>人员进入统计</div>
            <div class="count-num">{{inCount}}</div>
          </span>
        </div>
        <div class="out-count">
          <img src="../assets/image/outdoor.png" alt />
          <span>
            <div>人员出门统计</div>
            <div class="count-num">{{outCount}}</div>
          </span>
        </div>
      </div>
    </div>

  </div>
</template>

<script>
  // @ is an alias to /src
  import https from '@/assets/js/https.js'
export default {
  name: "face",
  data() {
    return {
      inCount: 1098,
      outCount: 437,
      items: [],
    };
  },
  mounted() {
    this.getFace();
    var that=this;
    this.$mytimer.addCallBack(this,function (host) {
      if (that==host){
        that.getFace();
      }
    })
  },
  props: ["userId"],
  methods: {
    getFace() {
      let params ={"userId":this.userId}
      let self = this;
      https.fetchGet('/web/VVID/Faces',params ).then((data) => {
        self.items = data.data.FaceListObject.FaceObject
      }).catch(err=>{
                console.log(err)
              }
      );
    },
    getItemImg(index){
      let itemsofimg = [];
      itemsofimg.push(this.items[index].SubImageList.SubImageInfoObject[0].StoragePath);
      return itemsofimg;
    }
  }
};
</script>

 <style lang="scss" scoped>
.container {
  display: flex;
}
.subtitle {
  position: absolute;
  z-index: 999;
  height: 45px;
  width: 248px;
  color: white;
  font-size: 14px;
  background: url(../assets/image/face.png);
  background-repeat: no-repeat;
  background-position-x: 100%;
  text-align: left;
  line-height: 45px;
  img {
    box-shadow: 0 0 10px #3893ff;
    margin: 0 10px 0 16px;
    vertical-align: middle;
  }
}
.right {
  margin-left: 10px;
  position: relative;
}
.left {
  width: 380px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}
.blue-square {
  display: inline-block;
  width: 120px;
  height: 120px;
  background: rgba(153, 181, 247, 0.1);
  border: 1px solid rgba(56, 147, 255, 0.3);
  margin: 0 0 12px 0;
  img {
    width:100%;
    height:100%;
  }
}
.count-wrapper {
  margin-top: 18px;
  width: 246px;
  height: 234px;
  background: rgba(153, 181, 247, 0.01);
  border: 1px solid rgba(56, 147, 255, 0.2);
  border-top: 1px solid rgba(56, 147, 255, 0.01);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  span {
    margin-left: 35px;
  }
  img {
    margin-left: 25px;
    flex: 0 0 30px;
    height: 30px;
  }
  .in-count {
    margin-bottom: 25px;
    margin-top: 18px;
  }
  & > div {
    display: flex;
    align-items: center;
    width: 220px;
    height: 67px;
    font-size: 13px;
    color: white;
    background-image: url(../assets/image/count-wrapper.png);
  }
  .count-num {
    font-size: 20px;
    color: rgba(0, 250, 255, 1);
    font-weight: bold;
    margin-top: 3px;
  }
}
</style>


